package test;

import java.util.ArrayList;
import java.util.List;

public class Player {
	private String name;
	private int score;
	private List<RPSEnum> moves;
	private int numberOfMoves;
	
	public Player(String name, List<RPSEnum> moves)
	{
		this.name = name;
		this.moves = new ArrayList<RPSEnum>();
		this.moves.addAll(moves);
		this.numberOfMoves = moves.size();
	}

	public Player(String name)
	{
		this.name = name;
		this.moves = new ArrayList<RPSEnum>();
		numberOfMoves = 10;
		for (int i = 0; i<numberOfMoves; i++)
		{
			this.moves.add(enumGenerator());
		}
		
	}
	
	public RPSEnum getNextMove(int index)
	{
		RPSEnum nextMove = moves.get(index);
		return nextMove;
	}
	
	private RPSEnum enumGenerator()
	{
		int number = (int) (Math.random()*3);
		
		switch(number){
		case 0:
			return RPSEnum.PAPER;
		case 1:
			return RPSEnum.ROCK;
		case 2:
			return RPSEnum.SCISSORS;
			
			default:
				return RPSEnum.PAPER;
		}
	}

	public String getName() {
		return name;
	}

	public int getScore() {
		return score;
	}

	public int getNumberOfMoves() {
		return numberOfMoves;
	}
	
	public void setScore(int score) {
		this.score = score;
	}
}
